{# src/Acme/UserBundle/Resources/views/Form/fields.html.twig #}


{% block choice_widget_collapsed %}
{% spaceless %}
    {% if required and empty_value is none and not empty_value_in_choices %}
        {% set required = false %}
    {% endif %}
    <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %} class="form-control">
        {% if empty_value is not none %}
            <option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
        {% endif %}
        {% if preferred_choices|length > 0 %}
            {% set options = preferred_choices %}
            {{ block('choice_widget_options') }}
            {% if choices|length > 0 and separator is not none %}
                <option disabled="disabled">{{ separator }}</option>
            {% endif %}
        {% endif %}
        {% set options = choices %}
        {{ block('choice_widget_options') }}
    </select>
{% endspaceless %}
{% endblock choice_widget_collapsed %}

{% block date_widget %}
{% spaceless %}
    {% if widget == 'single_text' %}
        {{ block('form_widget_simple') }}
    {% else %}
        <div {{ block('widget_container_attributes') }} class="col-md-4" style="padding-left:0px;">
        	<div class="form-group">
        		{{ form_label(form.day) }}
        		{{ form_errors(form.day) }}
	            {{ date_pattern|replace({
	                '{{ day }}':   form_widget(form.day, {value: information.day ~ "" }),
	                '{{ month }}': '',
	                '{{ year }}': '',
	                
	            })|raw }}
            </div>
        </div>
        <div {{ block('widget_container_attributes') }} class="col-md-4" style="padding-left:0px;">
        	<div class="form-group">
        		{{ form_label(form.month) }}
        		{{ form_errors(form.month) }}
	            {{ date_pattern|replace({
	                '{{ day }}': '',
	                '{{ month }}' : form_widget(form.month, {value: information.month ~ "" }),
	                '{{ year }}': '',
	            })|raw }}
            </div>
        </div>
        <div {{ block('widget_container_attributes') }} class="col-md-4" style="padding-left:0px;">
        	<div class="form-group">
        		{{ form_label(form.year) }}
        		{{ form_errors(form.year) }}
	            {{ date_pattern|replace({
	                '{{ day }}': '',
	                '{{ month }}': '',
	                '{{ year }}':  form_widget(form.year, {value: information.year ~ "" }),
	            })|raw }}
            </div>
        </div>
        
    {% endif %}
{% endspaceless %}
{% endblock date_widget %}

{% block form_widget_simple %}
{% spaceless %}
    {% set type = type|default('text') %}
    <input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} class="form-control" />
{% endspaceless %}
{% endblock form_widget_simple %}

{% block textarea_widget %}
{% spaceless %}
    <textarea class="form-control" rows="1" {{ block('widget_attributes') }}>{{ value }}</textarea>
{% endspaceless %}
{% endblock textarea_widget %}

